var locationIds = new Array()
function initTree(treeList) {
    $('#locationTree').jstree({
        core: {
            data: treeList,
            check_callback: true,
            multiple: true,
            themes: {stripes: true},
            expand_selected_onload: false
        },
        force_text: true,
        plugins: ["wholerow", "checkbox", "types"],
        checkbox: {
            keep_selected_style: false,
            three_state: true
        }
    });
    $('#locationTree').on('changed.jstree', function (e, data) {
        locationIds = new Array();
        data.selected.forEach(function (e) {
            locationIds.push({locationId: e})
        })
    });
}